Skip to content

fix(mail): observe toolbar width changes#1834

Open
KaannKara wants to merge 3 commits into
runbox:masterfrom
KaannKara:optimize-toolbar-width-calculation
Open

fix(mail): observe toolbar width changes#1834
KaannKara wants to merge 3 commits into
runbox:masterfrom
KaannKara:optimize-toolbar-width-calculation

Conversation

@KaannKara
Copy link
Copy Markdown

Fixes #1656.

Summary

  • Move toolbar width recalculation out of ngDoCheck.
  • Observe the toolbar button container with ResizeObserver and recalculate only when its width can change.
  • Keep the existing mailto interceptor rebinding behavior intact.

Tests

  • npx tsc -p src/tsconfig.spec.json --noEmit
  • npm run lint (passes with existing warnings)
  • npm run policy (passes; reports existing historical commit-message notes)
  • npm run build (passes with existing Angular/CommonJS warnings)
  • npm run test -- --watch=false --browsers=ChromeHeadless --include=src/app/mailviewer/singlemailviewer.component.spec.ts (blocked: ChromeHeadless launcher is not registered in this checkout)

AI use disclosure

  • Used OpenAI Codex to inspect the issue, implement the patch, and run local validation.

Copy link
Copy Markdown

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 2ad81055f9

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment on lines +344 to +346
this.toolbarResizeObserver = new ResizeObserver(() => {
this.calculateWidthDependentElements();
});
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge Run toolbar resize callback inside Angular zone

The new ResizeObserver callback updates morebuttonindex/attachmentAreaCols directly, but this app does not import the Zone.js ResizeObserver patch (src/polyfills.ts only imports zone.js). In this setup, ResizeObserver callbacks can run outside Angular change detection, so toolbar state changes after a resize may not render until some unrelated UI event triggers another check. Wrap the callback in NgZone.run(...) (or explicitly patch ResizeObserver) so width-driven toolbar updates are reliably reflected immediately.

Useful? React with 👍 / 👎.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

calculateWidthDependentElements function is called too often

1 participant